<template>
  <div class="ai-panel-toggle" @click="handleToggle" :title="title">
    <i :class="collapsed ? 'el-icon-arrow-left' : 'el-icon-arrow-right'"></i>
  </div>
</template>

<script>
export default {
  name: 'AiPanelToggle',
  props: {
    collapsed: {
      type: Boolean,
      default: false
    },
    title: {
      type: String,
      default: '切换 AI 面板'
    }
  },
  methods: {
    handleToggle() {
      this.$emit('toggle');
    }
  }
}
</script>

<style scoped>
@import '../styles/variables.css';

.ai-panel-toggle {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 24px;
  height: 70px;
  background-color: rgba(64, 158, 255, 0.8);
  border-radius: 6px 0 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  z-index: 101; /* 确保在面板上方 */
  transition: background-color 0.2s ease-out;
}

.ai-panel-toggle:hover {
  background-color: rgba(64, 158, 255, 1);
}

.ai-panel-toggle i {
  font-size: 18px;
  font-weight: bold;
}
</style>
